Skip to content

Validate LogEntry metadata; increase flash z-index#257

Merged
pranavrao145 merged 10 commits intomainfrom
log_entry_prevent_empty_form
Mar 28, 2026
Merged

Validate LogEntry metadata; increase flash z-index#257
pranavrao145 merged 10 commits intomainfrom
log_entry_prevent_empty_form

Conversation

@rashusharda
Copy link
Copy Markdown
Contributor

@rashusharda rashusharda commented Mar 23, 2026

TL;DR

Fixes a bug where a LogEntry could be saved with no content. Adds a model-level validation to block empty submissions, and fixes flash notifications rendering behind the modal overlay.


What is this PR trying to achieve?

Addresses #249 — a log entry could be created without any fields filled in. Clicking "Create Log Entry" on a blank form would succeed, resulting in empty records in the database.


How did you achieve it?

Added a custom validate method at_least_one_metadata_field_present that checks whether the metadata JSON column contains at least one non-blank value. If all fields are empty, an error is added to :base and the save is blocked.


Checklist

  • Changes have been top-hatted locally
  • Tests have been added or updated
  • Documentation has been updated (if applicable)
  • Linked related issues

@rashusharda rashusharda added the frontend This is related to the frontend label Mar 23, 2026
Copilot AI review requested due to automatic review settings March 23, 2026 21:09
@rashusharda rashusharda linked an issue Mar 23, 2026 that may be closed by this pull request
@rashusharda rashusharda self-assigned this Mar 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents creating LogEntry records with effectively empty metadata (addressing issue #249) and attempts to ensure flash notifications render above modal overlays.

Changes:

  • Added a model-level validation on LogEntry to require at least one non-empty metadata value before saving.
  • Increased the flash container’s z-index to avoid being covered by the modal overlay.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
app/views/shared/_flash.html.erb Raises flash z-index to display above modal overlay.
app/models/log_entry.rb Adds custom validation to block “empty” metadata submissions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 23, 2026 21:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 28, 2026 02:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 28, 2026 03:37
rashusharda and others added 8 commits March 27, 2026 23:37
Add a custom validation to LogEntry to ensure at least one metadata field is present before saving. Also bump the flash partial's z-index class from z-50 to z-9999 so flash notifications render above other UI elements.
Insert an i18n-tasks-use comment into LogEntry#not_empty referencing activerecord.errors.models.log_entry.attributes.base.not_empty so i18n-tasks will detect the translation key. This is a no-op change at runtime and prevents the key from being reported as unused by static analysis.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 28, 2026 04:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pranavrao145 pranavrao145 force-pushed the log_entry_prevent_empty_form branch from ea5e5d4 to 72d1a73 Compare March 28, 2026 04:19
@pranavrao145 pranavrao145 merged commit e9b8e02 into main Mar 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend This is related to the frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Log entry can be created without any content

4 participants